package com.laycoding.consumer;

import com.laycoding.common.service.UserService;
import com.laycoding.common.util.ZkUtils;
import com.laycoding.consumer.handler.ZkConsumerHandler;
import com.laycoding.consumer.proxy.RpcProxy;
import com.laycoding.consumer.proxy.ServiceProxy;
import org.apache.curator.framework.CuratorFramework;

public class ConsumerApplication {
    public static void main(String[] args) {
     /*   UserService userService = RpcProxy.create(UserService.class);
        System.out.println(userService.getUserName("测试"));*/


        ZkConsumerHandler zkConsumerHandler = new ZkConsumerHandler();
        CuratorFramework client = ZkUtils.getClient();
        zkConsumerHandler.getUrl(client,"/order","rpcservice");
            try {
                zkConsumerHandler.doListener(client,"/order");

                UserService userService = RpcProxy.create(UserService.class);
                System.out.println(userService.getUserName("测试"));
                Thread.sleep(Integer.MAX_VALUE);
            } catch (Exception e) {
                e.printStackTrace();
            }


    }
}
